package com.example.dingtalklogin.service;

import com.example.dingtalklogin.service.dto.DingtalkBindingCmd;
import com.example.dingtalklogin.service.dto.DingtalkLoginCmd;
import com.example.dingtalklogin.service.dto.data.UserDto;
import com.example.dingtalklogin.service.executor.DingtalkBindingCmdExe;
import com.example.dingtalklogin.service.executor.DingtalkLoginCmdExe;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 钉钉相关业务
 * @author xuzhen97
 */
@Service
public class DingtalkService {

    @Resource
    private DingtalkBindingCmdExe dingtalkBindingCmdExe;
    @Resource
    private DingtalkLoginCmdExe dingtalkLoginCmdExe;

    /**
     * 绑定钉钉账号
     * @param cmd
     */
    public void binding(DingtalkBindingCmd cmd){
        dingtalkBindingCmdExe.execute(cmd);
    }

    /**
     * 钉钉登录
     * @param cmd
     * @return
     */
    public UserDto login(DingtalkLoginCmd cmd){
        return dingtalkLoginCmdExe.execute(cmd);
    }
}
